package com.ccit.springbootlaw.pojo;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "cases") // 显式指定表名
// 案例信息表 (cases)
// id (主键)
// title (案例标题)
// content (案例内容)
// category (案例类别)
// author(案例部门级别)
// casetime (案例时间)
// created_at (创建时间)
// updated_at (更新时间)
public class Case {
    private int id;
    private String title;
    private String content;
    private String category;
    private String author;
    private Date casetime;
    private Timestamp created_at;
    private Timestamp updated_at;

    @Id
    @Column(name = "id")
    // id (主键)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "title")
    // title (案例标题)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "content")
    // content (案例内容)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Basic
    @Column(name = "category")
    // category (案例类别)
    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @Basic
    @Column(name = "author")
    // author(案例部门级别)
    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    @Basic
    @Column(name = "casetime")
    // casetime (案例时间)
    public Date getCasetime() {
        return casetime;
    }

    public void setCasetime(Date casetime) {
        this.casetime = casetime;
    }

    @Basic
    @Column(name = "created_at")
    // created_at (创建时间)
    public Timestamp getCreatedAt() {
        return created_at;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.created_at = createdAt;
    }

    @Basic
    @Column(name = "updated_at")
    // updated_at (更新时间)
    public Timestamp getUpdatedAt() {
        return updated_at;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updated_at = updatedAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Case cases = (Case) o;
        return id == cases.id && Objects.equals(title, cases.title) && Objects.equals(content, cases.content) && Objects.equals(category, cases.category) && Objects.equals(author, cases.author) && Objects.equals(created_at, cases.created_at) && Objects.equals(updated_at, cases.updated_at);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, content, category, author, created_at, updated_at);
    }
}